package com.example.keleInterface.controller;

import com.example.keleInterface.model.InterfaceUser;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * @author kelez
 */
@RestController
@RequestMapping("/")
public class BasicController {

    // http://127.0.0.1:8103/api/hello?name=lisi
    @GetMapping("/hello")
    public String hello(@RequestParam String name, HttpServletRequest request) {
        return "Hello " + name;
    }

    // http://127.0.0.1:8103/api/save_user
    @PostMapping("/save_user")
    public String saveUser(@RequestBody InterfaceUser u, HttpServletRequest request) {
        return "user will save: name=" + u.getName() + ", age=" + u.getAge();
    }
}
